package com.siyuanren.gcocp.mapper;

import com.siyuanren.gcocp.dto.HomeworkQuestionDTO;
import com.siyuanren.gcocp.mapper.base.WxUserHomeworkAnswerMapper;
import com.siyuanren.gcocp.vo.HomeworkAnswerVO;
import com.siyuanren.gcocp.vo.QueryChapterHomeworkVO;

import java.util.List;

/**
 * Created by   anxing
 * Project_name gcocp-parent
 * Path         com.siyuanren.gcocp.mapper
 * Date         2018/4/17
 * Time         13:11
 * Description
 */
public interface MyWxHomeworkMapper extends WxUserHomeworkAnswerMapper {

    /**
     * 返回章节课堂作业
     * @param queryChapterHomeworkVO
     * @return
     *    SELECT a.id answer_id,a.`sort` answer_sort, a.`answer_name`, a.`answer_right`, ua.`user_answer`, hq.*
    FROM wx_homework_answer a,wx_homework_question hq
    LEFT JOIN(
    SELECT * FROM wx_user_homework_answer ha WHERE user_id=1 AND ha.`available`=1)ua ON hq.id=ua.`question_id`
    WHERE hq.`chapter_id`=150 AND a.`question_id` = hq.`id` AND hq.`available`=1 ORDER BY answer_sort DESC
     */
    public List<HomeworkQuestionDTO> getChapterHomework(QueryChapterHomeworkVO queryChapterHomeworkVO) throws Exception;

}
